package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class CloudItem extends AppCompatActivity {
    private EditText hashInput;
    private Button myCloud;
    private Button otherCloud;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_cloud_item);
        hashInput=(EditText)findViewById(R.id.InventCode);
    }

    public static String getHashCode(String code) {
        int Value = Integer.valueOf(code);
        Value =2*Value+3;
        String Result=Integer.toString(Value)+"512";
        return Result;
    }
    public static String decodeHashCode(String code){
        code=code.substring(0,code.length()-3);
//        System.out.println(code);
        int Value=Integer.valueOf(code);
        return Integer.toString((Value-3)/2);
    }

    public void MyCould(View view){
        startActivity(new Intent(CloudItem.this,MyCloud.class));
    }
    public void OtherCould(View view){
        Intent intent=new  Intent(CloudItem.this,OtherCloud.class);
        intent.putExtra("HashCode",hashInput.getText().toString());//从现在开始，我将一个bug都不报并且超神
        startActivity(intent);
    }
}